<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <title>ISeeAdmin 【Transfer 穿梭框】 </title>
    <!--    <link rel="stylesheet" href="/static/element/index.css">-->
    <link href="https://cdn.staticfile.org/element-ui/2.12.0/theme-chalk/index.css" rel="stylesheet">
    <link rel="stylesheet" href="/static/iconfont/iconfont.css">
    <link rel="stylesheet" href="/static/css/common.css">
    <!--    开发环境-->
    <!--        <script src="/static/js/iseeadmin.js"></script>-->
    <!--    正式环境-->
    <script src="/static/js/iseeadmin.min.js"></script>
    <script src="/static/js/menu.js"></script>
    <!--    开发环境-->
    <!--    <script src="/static/js/vue.js"></script>-->
    <!--    正式环境-->
    <!--        <script src="/static/js/vue.min.js"></script>-->
    <script src="https://cdn.staticfile.org/vue/2.6.10/vue.min.js"></script>
    <!--    <script src="/static/element/index.js"></script>-->
    <script src="https://cdn.staticfile.org/element-ui/2.12.0/index.js"></script>
    <!--    <script src="/static/js/axios.min.js"></script>-->
    <style>
        .transfer-footer {
            margin-left: 20px;
            padding: 6px 5px;
        }
    </style>
</head>
<body>
<div id="app" v-cloak>
    <el-container style="height: 100%;min-height:100vh;">
        <el-aside v-show="iseeData.asideShow" width="210px">
            <!--            左侧logo 开始-->
            <div class="aside-logo">
                <img class="aside-logo-img" src="/static/images/logo.png"
                     alt=""> ISeeAdmin
            </div>
            <!--            左侧logo 结束-->
            <!--            左侧菜单 开始-->
            <el-menu @select="iseeMenuOpen" style="width: 210px;"
                     unique-opened
                     :default-active="iseeData.defaultActive"
                     background-color="#304156"
                     text-color="#bfcbd9"
                     active-text-color="#409eff">
                <iseemenu :menu="iseeData.menu"></iseemenu>
            </el-menu>
            <!--            左侧菜单 结束-->
        </el-aside>

        <el-container>
            <el-header height="83px">
                <div class="isee-header-div">
                    <!--                    面包屑 开始-->
                    <div style="width: 100%;display: inherit;">
                        <span class="aside-show" @click="iseeAsideShow">
                            <i :class="iseeData.asideShowIcon"></i>
                        </span>

                        <el-breadcrumb style="line-height: 50px" separator="/">
                            <el-breadcrumb-item v-for="(item,index) in iseeData.breadcrumb" :key="index">{{item.title}}
                            </el-breadcrumb-item>
                        </el-breadcrumb>
                    </div>
                    <!--                    面包屑 结束-->
                    <!--                    icon功能列表，可根据需要修改 开始-->
                    <div>
                        <ul class="isee-ul">
                            <li class="isee-li">
                                <i style="font-size: 20px" class="el-icon-bell"></i>
                            </li>
                            <li @click="iseeFullScreen" class="isee-li">
                                <span class="iconfont" style="font-size: 20px" v-html="iseeData.fullscreenIcon"></span>
                            </li>
                            <li class="isee-li" @click="iseeData.drawer = true">
                                <span class="iconfont" style="font-size: 20px">&#xe602;</span>
                            </li>
                        </ul>
                    </div>
                    <!--                    icon功能列表，可根据需要修改 结束-->
                    <!--                    avatar显示 开始-->
                    <div>
                        <el-dropdown @command="iseeOpenUrl">
                              <span class="el-dropdown-link">
                                  <el-avatar style="margin-top: 9px" :size="iseeData.avatar.size"
                                             :src="iseeData.avatar.url"></el-avatar>
                              </span>

                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item v-for="(item,index) in iseeData.avatar.list" :icon="item.icon"
                                                  :key="index" :command="index">{{item.title}}
                                </el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>
                    <!--                    avatar显示 结束-->
                </div>
                <div style="display: flex">
                    <!--                    标签页列表 开始-->
                    <span @click="iseeTagDivMove(1)" class="isee-tag-span">
                        <i class="el-icon-d-arrow-left"></i>
                    </span>
                    <div ref="iseeTagDiv" class="isee-tag-div">
                        <el-tag style="cursor:pointer;margin-right: 5px;" v-for="(item,index) in iseeData.tagList"
                                :key="index"
                                @click="iseeTagSwitch(item.url,item.index,item.breadcrumb)"
                                :effect="item.effect"
                                :type="item.type"
                                @close="iseeTagClose(item.url,index)"
                                size="medium"
                                :closable="item.closable"><i v-show="item.show" class="el-icon-view"></i> {{item.title}}
                        </el-tag>
                    </div>
                    <span @click="iseeTagDivMove(2)" class="isee-tag-span">
                        <i class="el-icon-d-arrow-right"></i>
                    </span>
                    <!--                    标签页列表 结束-->
                    <!--                    标签页集中操作 开始-->
                    <div style="float: right;margin-left: 10px">
                        <el-dropdown @command="iseeTagCommandClose">
                          <span class="el-dropdown-link">
                              <i class="el-icon-arrow-down isee-el-icon-arrow-down"></i>
                          </span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item command="1">关闭当前标签页</el-dropdown-item>
                                <el-dropdown-item command="2">关闭其它标签页</el-dropdown-item>
                                <el-dropdown-item command="3">关闭全部标签页</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>
                    <!--                    标签页集中操作 结束-->
                </div>

                <!--抽屉式展示-->
                <el-drawer
                        title="iseeAdmin"
                        :visible.sync="iseeData.drawer"
                        :direction="iseeData.direction"
                        :show-close="iseeData.showClose"
                        custom-class="isee-drawer-info"
                >
                    <el-divider></el-divider>
                    <div style="font-size: 14px">
                        <p class="isee-title">版本信息</p>
                        <ul class="isee-drawer-ul">
                            <li>
                                当前版本：iseeAdmin-v{{iseeData.version}}
                            </li>
                            <li>
                                基于框架：vue v2.6.10，element v2.12.0
                            </li>
                            <li>
                                下载地址：
                                <el-link type="primary" :underline="false" href="https://gitee.com/youge/iseeadmin"
                                         target="_blank">码云
                                </el-link>
                                |
                                <el-link type="primary" :underline="false" href="https://github.com/fukedi/iseeadmin"
                                         target="_blank">github
                                </el-link>
                            </li>
                        </ul>
                    </div>
                    <el-divider></el-divider>
                    <div style="font-size: 14px">
                        <p class="isee-title">关于版权</p>
                        <ul class="isee-drawer-ul">
                            <li>
                                iseeAdmin完全开源，可免费使用
                            </li>
                            <li>
                                QQ交流群：927049524
                            </li>
                        </ul>
                    </div>
                </el-drawer>
                <!--抽屉式展示 结束-->
            </el-header>

            <el-main>
                <!--                主内容展示-->
                <div style="margin-right: 10px">
                    <el-card class="box-card">
                        Transfer 穿梭框
                        <el-link type="primary" target="_blank"
                                 href="https://element.eleme.cn/#/zh-CN/component/transfer">
                            官方文档 https://element.eleme.cn/#/zh-CN/component/transfer
                        </el-link>
                    </el-card>
                </div>
                <div style="display: flex">
                    <el-card class="box-card">
                        <el-divider content-position="left"><span
                                class="el-divider-span">基础用法 <el-tooltip
                                content="Transfer 的数据通过 data 属性传入。数据需要是一个对象数组，每个对象有以下属性：key 为数据的唯一性标识，label 为显示文本，disabled 表示该项数据是否禁止转移。目标列表中的数据项会同步到绑定至 v-model 的变量，值为数据项的 key 所组成的数组。当然，如果希望在初始状态时目标列表不为空，可以像本例一样为 v-model 绑定的变量赋予一个初始值。 "
                                placement="top" effect="light"><i
                                class="el-icon-info" style="color: gray"></i></el-tooltip></span></el-divider>
                        <template>
                            <el-transfer v-model="value" :data="data"></el-transfer>
                        </template>

                        <el-divider content-position="left"><span
                                class="el-divider-span">可搜索 <el-tooltip
                                content="设置 filterable 为 true 即可开启搜索模式。默认情况下，若数据项的 label 属性包含搜索关键字，则会在搜索结果中显示。你也可以使用 filter-method 定义自己的搜索逻辑。filter-method 接收一个方法，当搜索关键字变化时，会将当前的关键字和每个数据项传给该方法。若方法返回 true，则会在搜索结果中显示对应的数据项。 "
                                placement="top" effect="light"><i
                                class="el-icon-info" style="color: gray"></i></el-tooltip></span></el-divider>
                        <template>
                            <el-transfer
                                    filterable
                                    :filter-method="filterMethod"
                                    filter-placeholder="请输入城市拼音"
                                    v-model="value1"
                                    :data="data1">
                            </el-transfer>
                        </template>

                        <el-divider content-position="left"><span
                                class="el-divider-span">数据项属性别名 <el-tooltip
                                content="默认情况下，Transfer 仅能识别数据项中的 key、label 和 disabled 字段。如果你的数据的字段名不同，可以使用 props 属性为它们设置别名。 "
                                placement="top" effect="light"><i
                                class="el-icon-info" style="color: gray"></i></el-tooltip></span></el-divider>
                        <template>
                            <el-transfer
                                    v-model="value5"
                                    :props="{
                                      key: 'value',
                                      label: 'desc'
                                    }"
                                    :data="data3">
                            </el-transfer>
                        </template>

                    </el-card>

                    <el-card class="box-card">

                        <el-divider content-position="left"><span
                                class="el-divider-span">可自定义 <el-tooltip
                                content="可以使用 titles、button-texts、render-content 和 format 属性分别对列表标题文案、按钮文案、数据项的渲染函数和列表顶部的勾选状态文案进行自定义。数据项的渲染还可以使用 scoped-slot 进行自定义。对于列表底部的内容区，提供了两个具名 slot：left-footer 和 right-footer。此外，如果希望某些数据项在初始化时就被勾选，可以使用 left-default-checked 和 right-default-checked 属性。最后，本例还展示了 change 事件的用法。注意：由于 jsfiddle 不支持 JSX 语法，所以使用 render-content 自定义数据项的例子在 jsfiddle 中无法运行。但是在实际的项目中，只要正确地配置了相关依赖，就可以正常运行。 "
                                placement="top" effect="light"><i
                                class="el-icon-info" style="color: gray"></i></el-tooltip></span></el-divider>
                        <template>
                            <p style="text-align: center; margin: 0 0 20px;color: #A00560;font-weight: bold">使用 render-content 自定义数据项</p>
                            <div style="text-align: center">
                                <el-transfer
                                        style="text-align: left; display: inline-block"
                                        v-model="value3"
                                        filterable
                                        :left-default-checked="[2, 3]"
                                        :right-default-checked="[1]"
                                        :render-content="renderFunc"
                                        :titles="['Source', 'Target']"
                                        :button-texts="['到左边', '到右边']"
                                        :format="{
                                            noChecked: '${total}',
                                            hasChecked: '${checked}/${total}'
                                          }"
                                        @change="handleChange"
                                        :data="data">
                                    <el-button class="transfer-footer" slot="left-footer" size="small">操作</el-button>
                                    <el-button class="transfer-footer" slot="right-footer" size="small">操作</el-button>
                                </el-transfer>
                            </div>
                            <p style="text-align: center; margin: 50px 0 20px;color: #A00560;font-weight: bold">使用 scoped-slot 自定义数据项</p>
                            <div style="text-align: center">
                                <el-transfer
                                        style="text-align: left; display: inline-block"
                                        v-model="value4"
                                        filterable
                                        :left-default-checked="[2, 3]"
                                        :right-default-checked="[1]"
                                        :titles="['Source', 'Target']"
                                        :button-texts="['到左边', '到右边']"
                                        :format="{
                                            noChecked: '${total}',
                                            hasChecked: '${checked}/${total}'
                                          }"
                                        @change="handleChange"
                                        :data="data2">
                                    <span slot-scope="{ option }">{{ option.key }} # {{ option.label }}</span>
                                    <el-button class="transfer-footer" slot="left-footer" size="small">操作</el-button>
                                    <el-button class="transfer-footer" slot="right-footer" size="small">操作</el-button>
                                </el-transfer>
                            </div>
                        </template>

                    </el-card>
                </div>
                <!--                主内容展示 结束-->
            </el-main>
        </el-container>
    </el-container>
</div>


<script>
  const iseeAvatar = {
    url: '/static/images/avatar01.gif',
    size: 32,
    list: [
      {
        index: '',
        indexPath: [],
        icon: 'el-icon-user-solid',
        url: '',
        target: '_self',
        title: 'admin',
      }, {
        index: '6-1-0',
        indexPath: ["6", "6-1", "6-1-0"],
        icon: 'el-icon-tickets',
        url: '/pages/sets/myset/profile.html',
        target: '_self',
        title: '基本资料',
      }, {
        index: '6-1-1',
        indexPath: ["6", "6-1", "6-1-1"],
        icon: 'el-icon-edit-outline',
        url: '/pages/sets/myset/password.html',
        target: '_self',
        title: '修改密码',
      }, {
        index: '',
        indexPath: [],
        icon: 'el-icon-switch-button',
        url: '',
        target: '_self',
        title: '安全退出',
      },
    ]
  }
  var iseemenu = {
    props: ['menu'],
    name: 'iseemenu',
    template: `
    <div>
        <template v-for="item in menu">
            <el-submenu :index="item.index" v-if="item.children.length">
                <template slot="title">
                    <i :class="item.icon"></i>
                    <span slot="title">{{item.title}}</span>
                </template>
                <iseemenu :menu="item.children"></iseemenu>
            </el-submenu>
            <el-menu-item :index="item.index" v-else>
                <i :class="item.icon"></i>
                <span slot="title">{{item.title}}</span>
            </el-menu-item>
        </template>
    </div>`,
  }

  const generateData = _ => {
    const data = [];
    for (let i = 1; i <= 15; i++) {
      data.push({
        key: i,
        label: `备选项 ${i}`,
        disabled: i % 4 === 0
      });
    }
    return data;
  };
  const generateData1 = _ => {
    const data = [];
    const cities = ['上海', '北京', '广州', '深圳', '南京', '西安', '成都'];
    const pinyin = ['shanghai', 'beijing', 'guangzhou', 'shenzhen', 'nanjing', 'xian', 'chengdu'];
    cities.forEach((city, index) => {
      data.push({
        label: city,
        key: index,
        pinyin: pinyin[index]
      });
    });
    return data;
  };
  const generateData2 = _ => {
    const data = [];
    for (let i = 1; i <= 15; i++) {
      data.push({
        key: i,
        label: `备选项 ${i}`,
        disabled: i % 4 === 0
      });
    }
    return data;
  };
  const generateData3 = _ => {
    const data = [];
    for (let i = 1; i <= 15; i++) {
      data.push({
        value: i,
        desc: `备选项 ${ i }`,
        disabled: i % 4 === 0
      });
    }
    return data;
  };
  var app = new Vue({
    el: '#app',
    components: {
      iseemenu
    },
    data: {
      iseeData: {
        version: iseeAdmin.version,
        drawer: false,
        direction: 'rtl',
        showClose: false,
        status: false,
        show: true,
        asideShow: iseeAdmin.asideShow,
        asideShowIcon: iseeAdmin.asideShowIcon,
        fullscreen: false,
        fullscreenIcon: '&#xe610;',
        defaultActive: iseeAdmin.defaultActive,
        tagList: iseeAdmin.tagList,
        breadcrumb: iseeAdmin.breadcrumb,
        menu: iseeMenu,
        avatar: iseeAvatar
      },
      /*your data*/
      data: generateData(),
      data1: generateData1(),
      data2: generateData2(),
      data3: generateData3(),
      value: [1, 4],
      value1: [],
      value3: [1],
      value4: [1],
      value5: [],
    },
    methods: {
      iseeTagSwitch(url, index, breadcrumb) {
        iseeAdmin.iseeTagSwitch(url, index, breadcrumb, this.iseeData)
      },

      iseeTagClose(url, index) {
        iseeAdmin.iseeTagClose(url, index, this.iseeData)
      },

      iseeTagCommandClose(command) {
        iseeAdmin.iseeTagCommandClose(command, this.iseeData)
      },

      iseeMenuOpen(key, keyPath) {
        iseeAdmin.iseeMenuOpen(key, keyPath, this.iseeData)
      },

      iseeFullScreen() {
        iseeAdmin.iseeFullScreen(this.iseeData)
      },

      iseeAsideShow() {
        iseeAdmin.iseeAsideShow(this.iseeData)
      },
      iseeOpenUrl(command) {
        iseeAdmin.iseeMenuOpen(this.iseeData.avatar.list[command].index, this.iseeData.avatar.list[command].indexPath, this.iseeData)
      },
      iseeTagDivMove(flag) {
        flag == 1 ? this.$refs.iseeTagDiv.scrollLeft += 80 : this.$refs.iseeTagDiv.scrollLeft -= 80
      },
      /*your methods*/
      filterMethod(query, item) {
        return item.pinyin.indexOf(query) > -1;
      },
      renderFunc(h, option) {
        return h('span', {}, option.key + ' - ' + option.label);
      },
      handleChange(value, direction, movedKeys) {
        console.log(value, direction, movedKeys);
      }

    },
    beforeMount() {
      iseeAdmin.init(this.iseeData)
      /*your beforeMount*/
    },
    mounted() {

    }
  });
</script>
</body>

</html>

